﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DFGK_WMS.Context.Migrations
{
    public partial class 装备大数据统计模块 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "T_Equipment",
                columns: table => new
                {
                    EquipmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EquipmentName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    EquipmentCategory = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Quantity = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Equipment", x => x.EquipmentId);
                });

            //migrationBuilder.CreateTable(
            //    name: "T_EquipmentBasic",
            //    columns: table => new
            //    {
            //        Id = table.Column<long>(type: "bigint", nullable: false),
            //        Code = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        TechnicalTerms = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
            //        ServiceIndustry = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
            //        StandardsProtocols = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
            //        ConceptualExplanation = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
            //        TechnologyCompany = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        Classification = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        ModelName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        SpecificationParameter = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        PerformanceIndex = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        UsageEnvironment = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        ApplicableScenarios = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        SupportingEquipment = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        MaintenanceRequirement = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        SpecificationModel = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
            //        CreateUserId = table.Column<long>(type: "bigint", nullable: false),
            //        CreateUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        ModifyUserId = table.Column<long>(type: "bigint", nullable: false),
            //        ModifyUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        IsDel = table.Column<bool>(type: "bit", nullable: false)
            //    },
            //    constraints: table =>
            //    {
            //        table.PrimaryKey("PK_T_EquipmentBasic", x => x.Id);
            //    });

            migrationBuilder.CreateTable(
                name: "T_EquipmentChange",
                columns: table => new
                {
                    EquipmentChangeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EquipmentName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    ChangeQuantity = table.Column<int>(type: "int", nullable: false),
                    ChangeDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EquipmentType = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_EquipmentChange", x => x.EquipmentChangeId);
                });

            migrationBuilder.CreateTable(
                name: "T_EquipmentStatistics",
                columns: table => new
                {
                    EquipmentStatisticsId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EquipmentId = table.Column<int>(type: "int", nullable: false),
                    Category = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    StatisticsDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_EquipmentStatistics", x => x.EquipmentStatisticsId);
                });

            migrationBuilder.CreateTable(
                name: "T_Organization",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Latitude = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Longitude = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Address = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    RegionId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Organization", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Region",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Region", x => x.Id);
                });

            //migrationBuilder.CreateTable(
            //    name: "T_ScrapOrder",
            //    columns: table => new
            //    {
            //        Id = table.Column<long>(type: "bigint", nullable: false),
            //        OrderSn = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        Status = table.Column<int>(type: "int", nullable: false),
            //        Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        SubmitPeople = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        CreateUserId = table.Column<long>(type: "bigint", nullable: false),
            //        CreateUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        ModifyUserId = table.Column<long>(type: "bigint", nullable: false),
            //        ModifyUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        IsDel = table.Column<bool>(type: "bit", nullable: false)
            //    },
            //    constraints: table =>
            //    {
            //        table.PrimaryKey("PK_T_ScrapOrder", x => x.Id);
            //    });

            //migrationBuilder.CreateTable(
            //    name: "T_ScrapOrderDetail",
            //    columns: table => new
            //    {
            //        Id = table.Column<long>(type: "bigint", nullable: false),
            //        OrderSn = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        MaterialId = table.Column<int>(type: "int", nullable: false),
            //        MaterialName = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        MaterialCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        Process = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        Status = table.Column<int>(type: "int", nullable: false),
            //        SubmitPeople = table.Column<string>(type: "nvarchar(max)", nullable: true),
            //        CreateUserId = table.Column<long>(type: "bigint", nullable: false),
            //        CreateUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        ModifyUserId = table.Column<long>(type: "bigint", nullable: false),
            //        ModifyUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
            //        ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: false),
            //        IsDel = table.Column<bool>(type: "bit", nullable: false)
            //    },
            //    constraints: table =>
            //    {
            //        table.PrimaryKey("PK_T_ScrapOrderDetail", x => x.Id);
            //    });

            migrationBuilder.CreateTable(
                name: "T_Statistics",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RegionId = table.Column<int>(type: "int", nullable: false),
                    TotalCount = table.Column<int>(type: "int", nullable: false),
                    StatisticsDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Statistics", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_UnitEquipment",
                columns: table => new
                {
                    UnitEquipmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UnitName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    EquipmentId = table.Column<int>(type: "int", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_UnitEquipment", x => x.UnitEquipmentId);
                });

            migrationBuilder.CreateTable(
                name: "T_VehicleOrganizationStats",
                columns: table => new
                {
                    StatsId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Organization = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    VehicleCategory = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    TotalQuantity = table.Column<int>(type: "int", nullable: false),
                    Percentage = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_VehicleOrganizationStats", x => x.StatsId);
                });

            migrationBuilder.CreateTable(
                name: "T_VehiclePurchases",
                columns: table => new
                {
                    PurchaseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    VehicleId = table.Column<int>(type: "int", nullable: false),
                    PurchaseDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    TotalCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_VehiclePurchases", x => x.PurchaseId);
                });

            migrationBuilder.CreateTable(
                name: "T_Vehicles",
                columns: table => new
                {
                    VehicleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Category = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Organization = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    PurchaseDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Vehicles", x => x.VehicleId);
                });

            migrationBuilder.CreateTable(
                name: "T_VehicleStatus",
                columns: table => new
                {
                    VehicleStatusId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    VehicleId = table.Column<int>(type: "int", nullable: false),
                    Status = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_VehicleStatus", x => x.VehicleStatusId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_Equipment");

            migrationBuilder.DropTable(
                name: "T_EquipmentBasic");

            migrationBuilder.DropTable(
                name: "T_EquipmentChange");

            migrationBuilder.DropTable(
                name: "T_EquipmentStatistics");

            migrationBuilder.DropTable(
                name: "T_Organization");

            migrationBuilder.DropTable(
                name: "T_Region");

            migrationBuilder.DropTable(
                name: "T_ScrapOrder");

            migrationBuilder.DropTable(
                name: "T_ScrapOrderDetail");

            migrationBuilder.DropTable(
                name: "T_Statistics");

            migrationBuilder.DropTable(
                name: "T_UnitEquipment");

            migrationBuilder.DropTable(
                name: "T_VehicleOrganizationStats");

            migrationBuilder.DropTable(
                name: "T_VehiclePurchases");

            migrationBuilder.DropTable(
                name: "T_Vehicles");

            migrationBuilder.DropTable(
                name: "T_VehicleStatus");
        }
    }
}
